package kr.hkit.powerjava.chapter12.pro;

public class Person implements Comparable{
	private String name;
	private int height;
	
	public Person(){}
	
	public Person(String name, int height) {
		this.name = name;
		this.height = height;
	}
	
	public String getName() {
		return name;
	}

	public int getHeight() {
		return height;
	}

	@Override
	public String toString() {
		return String.format("이름=%s, 키=%s]", name, height);
	}

	@Override
	public int compareTo(Object o) {
		Person obj = (Person) o;
		if (this.height - obj.height > 0) {
			return 1;
		}else if (this.height - obj.height < 0) {
			return -1;
		}else{
			return 0;
		}
		
	}
}
